<!DOCTYPE HTML>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />

    <link href="/static/v5/static/h-ui/css/H-ui.min.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" type="text/css" href="/static/v5/static/h-ui.admin/css/H-ui.admin.css" />
    <link rel="stylesheet" type="text/css" href="/static/v5/static/h-ui.admin/skin/default/skin.css" id="skin" />
    <link href="/static/v5/static/h-ui.admin/css/H-ui.login.css" rel="stylesheet" type="text/css" />
    <link href="/static/v5/static/h-ui.admin/css/style.css" rel="stylesheet" type="text/css" />
    <link href="/static/v5/lib/Hui-iconfont/1.0.8/iconfont.css" rel="stylesheet" type="text/css" />
    <title>文章类别管理</title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 文章类别管理 <span class="c-gray en">&gt;</span> 文章类别列表  <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">

    <div class="mt-20">
        <table class="table table-border table-bordered table-hover table-bg table-sort">
            <thead>
            <tr class="text-c">
                <th class="head0" width="5%">id</th>
                <th class="head0" width="10%">类别名称</th>
                <th class="head0" width="10%">banner</th>
                <th class="head0" width="10%">banner名称</th>
                <th class="head0" width="10%">banner跳转链接</th>
                <th class="head1" width="5%">操作</th>
            </tr>
            </thead>

                <tbody >
                <th:block  th:each="bean: ${articleCates}">
                    <tr class="text-c" id="table">
                        <td th:text="${bean.cate_id}"></td>
                        <td th:text="${bean.cate_name}"></td>
                        <td ><img th:src="${bean.cate_banner}" th:width="200px" height="50px"/></td>

                        <td th:text="${bean.cate_banner_name}"></td>
                        <td th:text="${bean.cate_banner_url}"></td>
                        <td class="td-manage">
                            <th:block  th:each="funcion, funcionStat: ${funcions.obj.sonFuncion}">
                                <a th:if="${funcion.func_name == '更新'}"  th:href="${funcion.link_url + bean.cate_id  + '&token='  + token}">更新</a>
                                <a th:if="${funcion.func_name == '删除'}" href="###"  th:onclick="|updateValid(${bean.cate_id})|">删除</a>
                            </th:block>
                        </td>
                    </tr>
                </th:block>
            </tbody>
        </table>
    </div>
</div>
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="/static/v5/lib/jquery/1.9.1/jquery.min.js"></script>
<script  th:inline="javascript">

    function updateValid(cate_id) {
        var data = "cate_id=" + cate_id  + "&token="  + sessionStorage.getItem("token");
        $.ajax({
            type:'post',
            url:'/v5/article/cate/update/state',
            dataType : 'json',
            data: data,
            contentType: "application/x-www-form-urlencoded; charset=utf-8",
            success:function(data){
                if (data.mark=="0") {
                    alert(data.tip);
                    window.location.reload();

                } else {
                    alert(data.tip);
                }
            },
            error: function(textStatus) {
                alert(textStatus);
            }

        });
    }
</script>

</body>
</html>
